package com.ita.service.impl;

import java.util.List;
import java.util.UUID;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.ita.dao.CustomerDao;
import com.ita.pojo.Customer;
import com.ita.service.CustomerManger;

@Service(value="cusManager")
public class CustomerManagerImpl implements CustomerManger {
	@Resource(name="cusDao")
	private CustomerDao customerDao;

	@Override
	public Customer addCustomer(Customer c) {

		c.setId(UUID.randomUUID().toString());
		customerDao.addCustomer(c);
		return c;
	}

	@Override
	public List<Customer> findAllCustomers() {

		return customerDao.findAllCustomers();
	}

	@Override
	public Customer updateCustomer(Customer c) {

		customerDao.updateCustomer(c);
		return c;
	}

	@Override
	public String deleteCustomer(String id) {

		customerDao.deleteCustomer(id);
		return "{}";
	}

}
